#ifndef PLATTHREADWINDOWS
#define PLATTHREADWINDOWS
#include <windows.h>

namespace Platinum{
	namespace Thread{
		typedef void (*TFunc)(void*);
		
		typedef DWORD ThreadID;		
		class DummyData {
			public:
				TFunc m_func;
				void* m_data;
		};
		
		DWORD WINAPI DummyRun( void* p_data );
		inline ThreadID Create(TFunc p_func, void* p_param );
		inline ThreadID GetID();
		inline void WaitForFinish( ThreadID p_thread );
		inline void Kill( ThreadID& p_thread );

//Windows already has Yield defined as Sleep(0) so we need to undef it
#ifdef Yield
#undef Yield
#endif
		inline void Yield( int p_milliseconds = 1 ) 
		{
			Sleep( p_milliseconds );
		}
		class Mutex {
			protected:
				// define the base mutex types
				CRITICAL_SECTION m_mutex;
			public:
				Mutex();			
				~Mutex();
				inline void Lock(){EnterCriticalSection( &m_mutex );}
				inline void Unlock(){LeaveCriticalSection( &m_mutex );}
		};  // end class Mutex

	}
}
#endif
